<html>
<head><meta charset="utf-8"><title>emacs semantic highlighting performance · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html">emacs semantic highlighting performance</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203965402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203965402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203965402">(Jul 15 2020 at 14:52)</a>:</h4>
<p>Unrelated, but have you tried semantic highlighting with Emacs?</p>



<a name="203965429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203965429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203965429">(Jul 15 2020 at 14:53)</a>:</h4>
<p>It is the bit where I worry most about JSON parsing perf on the client-side</p>



<a name="203966330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203966330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203966330">(Jul 15 2020 at 14:59)</a>:</h4>
<p>I haven't... wasn't really planning to do it before the upgrade <span aria-label="grimacing" class="emoji emoji-1f62c" role="img" title="grimacing">:grimacing:</span></p>



<a name="203966356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203966356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203966356">(Jul 15 2020 at 14:59)</a>:</h4>
<p>I have not; largely because I didn't know about it until I read your message and I don't yet even know how to enable it <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span></p>



<a name="203966995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203966995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203966995">(Jul 15 2020 at 15:04)</a>:</h4>
<p>Any hints on how to turn it on? <span aria-label="embarrassed" class="emoji emoji-1f633" role="img" title="embarrassed">:embarrassed:</span></p>



<a name="203967584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203967584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203967584">(Jul 15 2020 at 15:09)</a>:</h4>
<p><a href="https://github.com/emacs-lsp/lsp-mode/pull/1721/files#diff-b1e9bc82c3b6bd6e95470e18ee41a19bR173">https://github.com/emacs-lsp/lsp-mode/pull/1721/files#diff-b1e9bc82c3b6bd6e95470e18ee41a19bR173</a></p>



<a name="203967713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203967713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203967713">(Jul 15 2020 at 15:10)</a>:</h4>
<p>well, clicking that link killed that Chrome tab...</p>



<a name="203967999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203967999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203967999">(Jul 15 2020 at 15:12)</a>:</h4>
<p><code>(setq lsp-semantic-highlighting :semantic-tokens)</code> I guess</p>



<a name="203968185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203968185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203968185">(Jul 15 2020 at 15:13)</a>:</h4>
<p>ah no it's <code>(setq lsp-enable-semantic-highlighting t)</code> with current versions</p>



<a name="203972427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203972427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203972427">(Jul 15 2020 at 15:42)</a>:</h4>
<p>Heh, it looks like the current effect of that is that I only get highlighting on the first screen of a file <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="203972481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203972481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203972481">(Jul 15 2020 at 15:42)</a>:</h4>
<p>Or maybe it was just slow... it's there now.</p>



<a name="203972654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/203972654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#203972654">(Jul 15 2020 at 15:44)</a>:</h4>
<p>Well, I'll give it a whirl — updated RA to tip, updated emacs to tip, so what's one more change on the pile</p>



<a name="204313980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/204313980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#204313980">(Jul 18 2020 at 19:19)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> unrelated, did you publish your emacs config somewhere?<br>
<span class="user-mention" data-user-id="133169">@matklad</span> what is missing compared to vscode in emacs integration?</p>
<p>I would really love to use Emacs instead of VS Codium</p>



<a name="204314056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/204314056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#204314056">(Jul 18 2020 at 19:21)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="c1">;; Language server</span>
<span class="p">(</span><span class="k">setq</span> <span class="nv">lsp-keymap-prefix</span> <span class="s">&quot;C-x l&quot;</span><span class="p">)</span>
<span class="p">(</span><span class="k">setq</span> <span class="nv">lsp-enable-semantic-highlighting</span> <span class="no">t</span><span class="p">)</span>
<span class="p">(</span><span class="nb">require</span> <span class="ss">&#39;lsp-mode</span><span class="p">)</span>

<span class="c1">;; Rust</span>
<span class="p">(</span><span class="nf">load</span> <span class="s">&quot;ra-emacs-lsp&quot;</span><span class="p">)</span>
<span class="p">(</span><span class="nf">load</span> <span class="s">&quot;asf-rustdoc-edit&quot;</span><span class="p">)</span>

<span class="p">(</span><span class="nv">add-hook</span> <span class="ss">&#39;rust-mode-hook</span> <span class="ss">&#39;cargo-minor-mode</span><span class="p">)</span>
<span class="p">(</span><span class="nv">add-hook</span> <span class="ss">&#39;rust-mode-hook</span> <span class="nf">#&#39;</span><span class="nv">lsp</span><span class="p">)</span>

<span class="c1">;; Wrap error messages in cargo minor mode</span>
<span class="p">(</span><span class="nv">add-hook</span> <span class="ss">&#39;cargo-process-mode-hook</span> <span class="ss">&#39;turn-on-visual-line-mode</span><span class="p">)</span>
</code></pre></div>


<p>I don't, but that's the Rust-related parts. I'm almost certain that I've got stuff in there that doesn't work (e.g. the <code>lsp-keymap-prefix</code>)</p>



<a name="204339409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/204339409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#204339409">(Jul 19 2020 at 08:38)</a>:</h4>
<p><span class="user-mention silent" data-user-id="214522">Leo Le Bouter</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/emacs.20semantic.20highlighting.20performance/near/204313980">said</a>:</p>
<blockquote>
<p>I would really love to use Emacs instead of VS Codium</p>
</blockquote>
<p>Hi <span class="user-mention" data-user-id="214522">@Leo Le Bouter</span> if you're looking for another example, you might want to have a look also at mine:<br>
<a href="https://gitlab.com/apiraino/dotfiles/-/blob/master/emacs/.emacs.d/init.el#L34-84">https://gitlab.com/apiraino/dotfiles/-/blob/master/emacs/.emacs.d/init.el#L34-84</a></p>
<p>Same caveat applies: work-in-progress and some things might be broken :-)</p>
<p>edit: my config expects RA to be available in $PATH as <code>rust-analyzer</code></p>
<p>(btw - happy to receive feedback and suggestions)</p>



<a name="204370002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/204370002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#204370002">(Jul 19 2020 at 20:43)</a>:</h4>
<p><span class="user-mention" data-user-id="116155">@Jake Goulding</span> <span class="user-mention" data-user-id="250987">@apiraino</span> Thanks a lot to you both! I'll have a look - do you feel productive with Rust and Emacs right now?</p>



<a name="204372522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/204372522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> apiraino <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#204372522">(Jul 19 2020 at 21:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="214522">Leo Le Bouter</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/emacs.20semantic.20highlighting.20performance/near/204370002">said</a>:</p>
<blockquote>
<p>do you feel productive with Rust and Emacs right now?</p>
</blockquote>
<p>that's probably a general question about feeling productive with Emacs compared to other tools. As far as I am concerned, I feel that my skills in Rust (or lack thereof) are the limiting factor, Emacs certainly does not get in the way. But the game changer for me was using <code>rust-analyzer</code>, I feel much more at ease when writing code, it's a godsend.<br>
My topmost used feature is the type hinting. I used to provoke compiler error on purpose to understand what some function parameter  was expected to be, or what a certain function returned <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> <br>
Clearly, learning Emacs is not easy. You might also have a look at Spacemacs (that's an alternative version of Emacs, more "vim-like") and install LSP there</p>



<a name="204422865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/204422865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#204422865">(Jul 20 2020 at 13:39)</a>:</h4>
<p><span class="user-mention" data-user-id="250987">@apiraino</span> I am interested by Emacs because it is one of the rare tools that can provide a unified, integrated and coherent keyboard driven experience for all software</p>
<p>I also do use the compiler by causing errors on purpose because rust-analyzer fails some times</p>
<p>I tried Spacemacs but it's a bit too slow</p>



<a name="204428091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/204428091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wojciech Polak <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#204428091">(Jul 20 2020 at 14:22)</a>:</h4>
<p>Relation between Spacemacs and Emacs is similar to Debian and Linux. I'd also recommend Doom Emacs as its blazingly fast (at least on my projects, i didnt open RA) and has RA support.</p>



<a name="204443439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20semantic%20highlighting%20performance/near/204443439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leo Le Bouter <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20semantic.20highlighting.20performance.html#204443439">(Jul 20 2020 at 16:20)</a>:</h4>
<p><span class="user-mention" data-user-id="214828">@Wojciech Polak</span> I do know Spacemacs isnt Emacs even if Emacs's elisp implementation is also slow as a known fact - Doom Emacs looks interesting thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>